package com.tps.cloud.system.controller;


import com.tps.cloud.response.Result;
import com.tps.cloud.system.dto.SystemDeptDto;
import com.tps.cloud.system.service.SystemDeptService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.AllArgsConstructor;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * 部门管理 前端控制器
 */
@RestController
@AllArgsConstructor
@RequestMapping("/system/dept")
@Tag(name = "部门管理", description = "用于管理部门信息")
public class SystemDeptController {

    private final SystemDeptService systemDeptService;

    /**
     * 保存部门
     * @param systemDeptDto
     * @return
     */
    @PostMapping
    @Operation(summary = "创建部门", description = "创建部门")
    public Result save(@RequestBody SystemDeptDto systemDeptDto) {
        Long deptId = systemDeptService.createDept(systemDeptDto);
        return Result.ok(deptId);
    }
}
